﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="classQuery.aspx.cs" Inherits="Inter.MianShi.Webfrom.classQuery" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="Css/bootstrap.css" rel="stylesheet" />
    <link href="Css/style.css" rel="stylesheet" />
    <link href="Css/bootstrap-responsive.css" rel="stylesheet" />
    <script src="js/jquery2.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/ckform.js"></script>
    <script src="js/common.js"></script>
    <style type="text/css">
body {font-size: 20px;
	padding-bottom: 40px;
	background-color: #e9e7ef;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
    <script>
        $(function () {
            $("#addnew").click(function () {
                location.href = "classAdd.aspx";
            })
     
            $.ajax({
                url: "/Hander/ShowCompany.ashx",
                type: "post",
                success: function (d) {
                    var data = eval(d);
                    $(data).each(function (index, item) {
                        var la = "<tbody><tr><td>" + item.CompanyName + "</td><td>" + item.CompanyCompany + "</td><td><a  href='classUpdate.aspx?id=" + item.CompanyId + "'>修改</a></button></td><td><button type='submit' id='Button1' onclick='Del(" + item.CompanyId + ")'>删除</button></td></tr></tbody>";
                        $("#table1").append(la);
                    })
                }
            })
        })
        function Upt(id) {
            alert(id)
            $.ajax({
                
                url: "/Hander/UptCompany.ashx",
                type: "post",
                data: {
                    id:id
                },
                success: function (data) {
                    location.href = "classUpdate.aspx";
                }
            })
        }
        //根据编号删除公司
        function Del(id) {
            if (confirm("确认要删除吗？"))
            {
                $.ajax({
                    url: "/Hander/DelCompany.ashx",
                    type: "post",
                    data: {
                        id: id
                    },
                    success: function (data) {
                        if (data = 1) {
                            alert('删除成功');
                            location.href = 'classQuery.aspx';
                        }
                        else {
                            alert('当前系统繁忙');
                        }
                    }
                })
            }
        }
    </script>
    
</head>
<body>
	<form class="form-inline definewidth m20" action="#" method="get">
		 <font color="#777777"><strong>公司信息：</strong></font> 
		
	</form>
	<table class="table table-bordered table-hover definewidth m10" id="table1">
		<thead >
			<tr>
				<th>公司名称</th>
			    <th>公司描述</th>
                <th>修改</th>
				<th>删除</th>
			</tr>
		</thead>
	</table>

 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button"  id="addnew">
			<a href="#" >添加公司</a>
		</button>
	</body>

</html>
